package lg.minecraft.plugin.entityclear.util;

import org.bukkit.entity.EntityType;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.Nullable;

/**
 * @author langle__
 * @version 1.0
 */
public class EntityTypeUtil {

    @Contract("null -> null")
    @Nullable
    public static EntityType getEntityType(@Nullable String name) {
        if (name == null || name.isEmpty()) return null;
        try {
            return EntityType.valueOf(name.toUpperCase());
        } catch (IllegalArgumentException e) {
            return null;
        }
    }

}
